package com.eastfair.venueservice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDate;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.venueservice.enumeration.ServiceLossLossSourceEnum;
import com.eastfair.venueservice.enumeration.ServiceLossGoodsLossStateEnum;
import com.eastfair.venueservice.enumeration.ServiceLossReworkStateEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 报损记录
 * </p>
 *
 * @author dq
 * @since 2022-09-23
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("vsm_service_loss")
@ApiModel(value = "ServiceLoss", description = "报损记录")
@AllArgsConstructor
public class ServiceLoss extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用（确认状态）：1是 已确认；0否 未确认
     */
    @ApiModelProperty(value = "是否启用（确认状态）：1是 已确认；0否 未确认")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用（确认状态）：1是 已确认；0否 未确认")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 库存编码
     */
    @ApiModelProperty(value = "库存编码")
    @Size(max = 255, message = "库存编码长度不能超过255")
    @TableField(value = "inventory_code", condition = LIKE)
    @Excel(name = "库存编码")
    private String inventoryCode;

    /**
     * 报损类型 #{SEVERE_DAMAGE:严重损坏;PARTIAL_DAMAGE:部分损坏;SLIGHT_DAMAGE:轻微损坏}
     */
    @ApiModelProperty(value = "报损类型 #{SEVERE_DAMAGE:严重损坏;PARTIAL_DAMAGE:部分损坏;SLIGHT_DAMAGE:轻微损坏}")
    @TableField(value = "goods_loss_state")
    @Excel(name = "报损类型 #{SEVERE_DAMAGE:严重损坏;PARTIAL_DAMAGE:部分损坏;SLIGHT_DAMAGE:轻微损坏}", replace = {"严重损坏_SEVERE_DAMAGE", "部分损坏_PARTIAL_DAMAGE", "轻微损坏_SLIGHT_DAMAGE",  "_null"})
    private ServiceLossGoodsLossStateEnum goodsLossState;

    /**
     * 返修入库状态 #{NO:未返修入库;YES:已返修入库}
     */
    @ApiModelProperty(value = "返修入库状态 #{NO:未返修入库;YES:已返修入库}")
    @TableField(value = "rework_state")
    @Excel(name = "返修入库状态 #{NO:未返修入库;YES:已返修入库}", replace = {"未返修入库_NO", "已返修入库_YES",  "_null"})
    private ServiceLossReworkStateEnum reworkState;

    /**
     * 损坏数量
     */
    @ApiModelProperty(value = "损坏数量")
    @TableField(value = "loss_num")
    @Excel(name = "损坏数量")
    private BigDecimal lossNum;

    /**
     * 报损来源 #{IN_INVENTORY:入库报损;RETURN_SERVICE:归还报损}
     */
    @ApiModelProperty(value = "报损来源 #{IN_INVENTORY:入库报损;RETURN_SERVICE:归还报损}")
    @TableField(value = "loss_source")
    @Excel(name = "报损来源 #{IN_INVENTORY:入库报损;RETURN_SERVICE:归还报损}", replace = {"入库报损_IN_INVENTORY", "归还报损_RETURN_SERVICE",  "_null"})
    private ServiceLossLossSourceEnum lossSource;

    /**
     * 报损日期
     */
    @ApiModelProperty(value = "报损日期")
    @TableField(value = "loss_time")
    @Excel(name = "报损日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDate lossTime;

    /**
     * 报损经办人
     */
    @ApiModelProperty(value = "报损经办人")
    @TableField(value = "loss_operator")
    @Excel(name = "报损经办人")
    private Long lossOperator;

    /**
     * 报损经办人姓名
     */
    @ApiModelProperty(value = "报损经办人姓名")
    @Size(max = 100, message = "报损经办人姓名长度不能超过100")
    @TableField(value = "loss_operator_name", condition = LIKE)
    @Excel(name = "报损经办人姓名")
    private String lossOperatorName;

    /**
     * 返修入库日期
     */
    @ApiModelProperty(value = "返修入库日期")
    @TableField(value = "repair_time")
    @Excel(name = "返修入库日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDate repairTime;

    /**
     * 返修经办人
     */
    @ApiModelProperty(value = "返修经办人")
    @TableField(value = "repair_operator")
    @Excel(name = "返修经办人")
    private Long repairOperator;

    /**
     * 返修经办人姓名
     */
    @ApiModelProperty(value = "返修经办人姓名")
    @Size(max = 100, message = "返修经办人姓名长度不能超过100")
    @TableField(value = "repair_operator_name", condition = LIKE)
    @Excel(name = "返修经办人姓名")
    private String repairOperatorName;


    @Builder
    public ServiceLoss(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    String inventoryCode, ServiceLossGoodsLossStateEnum goodsLossState, ServiceLossReworkStateEnum reworkState, BigDecimal lossNum, ServiceLossLossSourceEnum lossSource, LocalDate lossTime, 
                    Long lossOperator, String lossOperatorName, LocalDate repairTime, Long repairOperator, String repairOperatorName) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.inventoryCode = inventoryCode;
        this.goodsLossState = goodsLossState;
        this.reworkState = reworkState;
        this.lossNum = lossNum;
        this.lossSource = lossSource;
        this.lossTime = lossTime;
        this.lossOperator = lossOperator;
        this.lossOperatorName = lossOperatorName;
        this.repairTime = repairTime;
        this.repairOperator = repairOperator;
        this.repairOperatorName = repairOperatorName;
    }

}
